﻿<Page
    x:Name="pageRoot"
    x:Class="Ch9RSS_Universal.ItemPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Ch9RSS_Universal"
    xmlns:data="using:Ch9RSS_Universal.Data"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:play="using:Microsoft.PlayerFramework"
    xmlns:convert="using:Ch9RSS_Universal.Converters"
    xmlns:s="using:System"
    mc:Ignorable="d">
    <Page.Resources>
        <convert:GroupToMediaConverter x:Key="GroupToMedia" />
        <x:Double x:Key="targetSize">240</x:Double>
    </Page.Resources>

    <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
        >
        <Grid.ChildrenTransitions>
            <TransitionCollection>
                <EntranceThemeTransition/>
            </TransitionCollection>
        </Grid.ChildrenTransitions>


        <Grid x:Name="contentRegion">
            <Grid.RowDefinitions>
                <RowDefinition Height="140"/>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition x:Name="FirstColumn" Width="327*"/>
                <ColumnDefinition Width="356*"/>
            </Grid.ColumnDefinitions>

            <Grid Grid.ColumnSpan="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="120"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

                <Button x:Name="backButton" Margin="39,59,39,0" Command="{Binding NavigationHelper.GoBackCommand, ElementName=pageRoot}"
                            Style="{StaticResource NavigationBackButtonNormalStyle}"
                            VerticalAlignment="Top"
                            AutomationProperties.Name="Back"
                            AutomationProperties.AutomationId="BackButton"
                            AutomationProperties.ItemType="Navigation Button"/>
                <TextBlock x:Name="pageTitle" Text="{Binding Ch9Post.title}" Style="{StaticResource HeaderTextBlockStyle}" Grid.Column="1" 
                            IsHitTestVisible="false" TextWrapping="NoWrap" VerticalAlignment="Bottom" Margin="0,0,30,40"/>
            </Grid>

            <WebView x:Name="itemContentView" 
                     Grid.RowSpan="2" 
                     Grid.Row="1"
                     Grid.Column="1" 
                     Margin="39,20,20,20" NavigationStarting="PushNavigationToIE"
                     
                     />
            <play:MediaPlayer 
                x:Name="sidePlayer" 
                Grid.Row="1" 
                Margin="20" 
                IsPauseEnabled="True"
                Source="{Binding Ch9Post.group, Converter={StaticResource GroupToMedia}}" 
                
                AutoPlay="False" 
                IsFullScreenVisible="True"
                IsFullScreenChanged="sidePlayer_IsFullScreenChanged" 
                IsPauseAllowedChanged="PauseAllowedChanged" MediaOpened="MediaOpened" 
                />
            <!-- item.description-->


            <!-- Back button and page title -->

        </Grid>

        <!--<play:MediaPlayer x:Name="fullScreenPlayer" 
                          Grid.RowSpan="2" 
                          Visibility="Collapsed"
                          Source="{Binding Ch9Post.group, Converter={StaticResource GroupToMedia}}" 
                          AutoPlay="False" 
                          IsFullScreenVisible="True"
                          IsFullScreenChanged="fullScreenPlayer_IsFullScreenChanged"/>-->

    </Grid>
</Page>
